import celery
import time

broker = 'amqp://admin:123456@10.4.7.20:5672'
backend = ''

cel = celery.Celery('test', broker=broker, backend=backend)

@cel.task
def send_email(name):
    print("向%s发送邮件..." % name)
    time.sleep(5)
    print("向%s发送邮件完成" % name)
    return "ok"


@cel.task
def send_msg(name):
    print("向%s发送短信..." % name)
    time.sleep(5)
    print("向%s发送短信完成" % name)
    return "ok"

